using System;

namespace ALPackage
{
    /// <summary>
    /// 层级管理节点数据基类
    /// </summary>
    public abstract class _AALUILayerBasicMonoData
    {
        protected _AALUILayerBasicNode _m_nNode = null;

        [ALHeader("相对父节点增加的层级")]
        public int addOrderInLayer = 10;
        
        public void discard()
        {
            //释放节点
            if(null != _m_nNode)
            {
                _m_nNode.discard();
                //处理释放函数
                _doDiscard();
            }
            _m_nNode = null;
        }
        
        /// <summary>
        /// 获取对应需要控制对象的实例Id
        /// </summary>
        public abstract int goInstanceId { get; }
        /// <summary>
        /// 创建对应控制节点的控制对象，各子类根据自己控制对象的不同返回不同控制类对象
        /// </summary>
        /// <returns></returns>
        protected abstract _IALUILayerBasicNodeObj _createUILayerNodeObj();
        /// <summary>
        /// 创建一个新的层级节点对象
        /// </summary>
        /// <returns></returns>
        public abstract _AALUILayerBasicNode createUILayerNode();
        /// <summary>
        /// 释放函数
        /// </summary>
        protected abstract void _doDiscard();
    }
}